import threading
import time

url = [
    f'www.baidu.com?qq={aaa}'
    for aaa in range(1, 10 + 1)
]


def sleep_time_second(s, l, k):
    print(f'子线程睡觉{s}秒')
    print(f'子线程l的参数{type(l)}')
    print(f'三个参数s={s}, l={l}, k={k}')
    for i in range(0, 10):
        time.sleep(i)
        print(f'子线程打印第{i}秒')


def execute_for_loop(param):
    time.sleep(2)
    print(f'param参数==={param}')
    return 2


def perction_url_list():
    print(url)
    for url_ch in url:
        task_1 = threading.Thread(target=execute_for_loop, args=(url_ch,))
        task_1.start()
        # 一定要用这种形式才是新创建一个子线程异步执行，不影响主线程继续执行
        taskk = threading.Thread(target=sleep_time_second, args=(1, [2], url_ch))
        taskk.start()
        print(f'循环体内的   主线程继续执行     不受子线程影响')
    print(f'for 循环外   的执行')


if __name__ == '__main__':
    perction_url_list()
    print(1111)
